#include "utility.h"
int
main()
{
    int multilock1;
    int condition1;
    int lockcondition1;
    int result;
    multilock1=CreateLock("multilock",10);
    Printf("mtlt1 main thread to create lock %d \n",multilock1);
    Printf("mtlt1dec the locknum, because it only create one lock, the pre lock belongs to another process\n ");
    multilock1--;
    Printf("mtlt1 try to acquire the lock %d\n ",multilock1);  
    result= AcquireLock(multilock1);
    if(-1==result){
        Printf("mtlt1 get the lock failed\n");
    }
    else
        {
        Printf("mtlt1 get the lock sucessfully\n");
    }
    
    lockcondition1=CreateLock("lockcondition1",20);
    condition1=CreateCV("condition1",15);
    Printf("mct1 main thread to create concdition %d \n",condition1);
    Printf("mclt1dec the locknum, because it only create one condition, the pre condition belongs to another process\n ");
    condition1--;
    Printf("mclt1 try to signal the condition %d\n ",condition1);  
    result= SignalCV(lockcondition1,condition1);
    if(-1==result){
        Printf("mclt1 get the lock failed\n");
    }
    else
        {
        Printf("mclt1 get the lock sucessfully\n");
    }

    
    Exit(0);
    /* not reached */
}

